<template>
    <div class="login">
      <div class="logo">

      </div>
    <div class="login-box">
      <p class="title">重置密码</p>
      <el-input type="password" v-model="password" style="width: 80%;height: 10%;margin-bottom: 7% ;" placeholder="请输入新密码" />
      <el-input type="password" v-model="again_password" style="width: 80%;height: 10%;margin-bottom: 7% ;" placeholder="请再次输入密码" /><br>
      <br>
      <el-button style="width: 80%; background-color: rgb(172, 96, 57);color: white; font-weight: 700;" @click="Confirm_password()">确认</el-button>
    </div>
  </div>
</template>

<script setup lang="ts">
import '../DQJ/Css/login.css'
import {putd} from '@/request/api/api.ts'
import {ref} from 'vue'
import {useRoute,useRouter} from 'vue-router'
const route = useRoute()
const router = useRouter()
let password = ref('')
let again_password = ref('')


let bind_contact = route.query.bind_contact

const Confirm_password = async()=>{
  // console.log(bind_contact);
  
  if(password.value == again_password.value){
    let data = await putd({bind_contact:bind_contact, password:password.value})
    console.log(data);
    
    if(data.code == 200){
    router.push('/')
      ElMessage({
      message: `${data.msg}`,
      type: 'success'
    })
    }
  }else{
    ElMessage({
      message: `两次密码输入的不一致`,
      type: 'success'
    })
  }
}

</script>

<style>

</style>